<?php
/**
 * LiveUrlModel
 *
 * PHP Version 5.4
 *
 * @author baohui  <baohui@icesmart.cn>
 */
namespace Model;
use Think\Model;
/**
 * Class RoomModel
 */
class LiveUrlModel extends BaseModel
{
    /**
     * construct
     */
    public function __construct()
    {
        $this->tableName  = 'live_urls';
        $this->primaryKey = 'id';
        parent::__construct();
    }

    /**
     * 验证通道名称
     *
     * @param  string $field 字段名
     * @param  string $value 字段值
     * @param  string $type  (unique) 验证类型
     *
     * @return bool
     */
    public function validateField($field, $value, $type)
    {
        switch ($type) {
            case "unique":
                $LiveUrl = $this->where("`{$field}` = '{$value}'")->find();
                if (!empty($LiveUrl)) {
                    return false;
                }
                break;
        }

        return true;
    }

}